//
//  CourseModel.m
//  Civacrm
//
//  Created by 王桂敏 on 2017/2/8.
//  Copyright © 2017年 王桂敏. All rights reserved.
//

#import "CourseModel.h"
#import "UserInfoModel.h"

@implementation CourseModel
//找到没有存进去的key，然后通过self.去赋值
- (void)setValue:(id)value forUndefinedKey:(NSString *)key{
    if ([key isEqualToString:@"task"]) {
        [self.taskModel setValuesForKeysWithDictionary:value];
    } else if ([key isEqualToString:@"userInfo"]){

        for (int i = 0; i < [(NSArray *)value count]; i++) {
            UserInfoModel *model = [[UserInfoModel alloc] init];
            [model setValuesForKeysWithDictionary:((NSArray *)value)[i]];
            [self.userInfoArray addObject:model];
        }
    }
}
- (TaskModel *)taskModel{
    if (!_taskModel) {
        self.taskModel = [[TaskModel alloc] init];
    }
    return _taskModel;
}
- (NSMutableArray *)userInfoArray{
    if (!_userInfoArray) {
        self.userInfoArray = [NSMutableArray array];
    }
    return _userInfoArray;
}
@end
